let navList = document.getElementsByClassName('nav')[0].children
let ulList = document.getElementsByClassName('info')[0].children
for (let i = 0; i < navList.length; i++) {
  navList[i].onclick = function () {
    // 再次遍历数组元素，设置被点击的元素为激活状态
    for (let j = 0; j < navList.length; j++) {
      if (i === j) {
        navList[j].setAttribute('class', 'active')
      } else {
        navList[j].removeAttribute('class')
      }
    }
    // 控制指定ul显示
    for (let j = 0; j < ulList.length; j++) {
      if (i === j) {
        ulList[j].setAttribute('class', 'active')
      } else {
        ulList[j].removeAttribute('class')
      }
    }
  }
}
